﻿Public Class xtf_LISTADOptioga_

    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Diámetro Nominal (pulgadas)")
            dtt_DataTable.Columns.Add("Diámetro Nominal (milímetros)")
            dtt_DataTable.Columns.Add("OD (pulgadas)")
            dtt_DataTable.Columns.Add("OD (milímetros)")
            dtt_DataTable.Columns.Add("ANSI")
            dtt_DataTable.Columns.Add("ASME")
            dtt_DataTable.Columns.Add("ASME(S)")
            dtt_DataTable.Columns.Add("Espesor (pulgadas)")
            dtt_DataTable.Columns.Add("Espesor (milímetros)")
            dtt_DataTable.Columns.Add("Peso (libras)")
            dtt_DataTable.Columns.Add("Peso (kilos)")
        

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_componente_ensayar As New cls_ptioga_
            If obj_componente_ensayar.CargarTodos(ObtenerRegistroEstado) Then
                For Each ptioga As cls_ptioga_ In obj_componente_ensayar.Items
                    AgregarItem(ptioga)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef ptioga As cls_ptioga_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow

        Row("Identificador (ID)") = ptioga.idptioga
        Row("Diámetro Nominal (pulgadas)") = ptioga.diametronominalp
        Row("Diámetro Nominal (milímetros)") = ptioga.diametronominalm
        Row("OD (pulgadas)") = ptioga.odp
        Row("OD (milímetros)") = ptioga.odm
        Row("ANSI") = ptioga.ansi
        Row("ASME") = ptioga.asme
        Row("ASME(S)") = ptioga.asmes
        Row("Espesor (pulgadas)") = ptioga.espesorp
        Row("Espesor (milímetros)") = ptioga.espesorm
        Row("Peso (libras)") = ptioga.pesol
        Row("Peso (kilos)") = ptioga.pesok

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef ptioga As cls_ptioga_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = ptioga.idptioga
        ulg_row("Diámetro Nominal (pulgadas)") = ptioga.diametronominalp
        ulg_row("Diámetro Nominal (milímetros)") = ptioga.diametronominalm
        ulg_row("OD (pulgadas)") = ptioga.odp
        ulg_row("OD (milímetros)") = ptioga.odm
        ulg_row("ANSI") = ptioga.ansi
        ulg_row("ASME") = ptioga.asme
        ulg_row("ASME(S)") = ptioga.asmes
        ulg_row("Espesor (pulgadas)") = ptioga.espesorp
        ulg_row("Espesor (milímetros)") = ptioga.espesorm
        ulg_row("Peso (libras)") = ptioga.pesol
        ulg_row("Peso (kilos)") = ptioga.pesok
    End Sub

    Public Sub New()
        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "001066002"
        PERMISOModificar = "001066003"
        PERMISOEliminar = "001066004"
        PERMISOImprimir = "001066005"
        Me.Text = lbl_modulo.Text : lbl_modulodescripcion.Text = "Listado de " & lbl_modulo.Text & "."
        IniciarLista()
        Me.Cursor = Cursors.Default
    End Sub
End Class


